from Crypto import Cipher
from Tools import RandomBySeed, Bxor
from hmacs import HmacBack

#加密
def SSEForKey(text, hashkey, seed):
    ciper = b""
    while(len(text) != 0):
        plain = text[:48]
        text = text[48:]
        plain = SSEForSingleKey(plain, hashkey, seed)
        ciper += plain
    return ciper

def SSEForSingleKey(text, hashkey, seed):
   

#解密
def DecodeBySSE(text, seed, hashkey):
    
    ciper = b""
    while(len(text) != 0):
        plain = text[:48]
        text = text[48:]
        plain = DecodeBySingleSSE(plain, hashkey, seed)
        ciper += plain
    return ciper

def DecodeBySingleSSE(text, seed, hashkey):
    
    